<form class="validate add-form" novalidate="novalidate">

    <div class="row">
        <div class="col-md-12">
            <div class="form-group">
                <label for="name" class="control-label">订单名称</label>
                <input type="text" id="name" class="form-control" name="name" placeholder="订单名称">
            </div>
        </div>
        <div class="col-md-8"> </div>
    </div>

    <div class="row">
        <div class="col-md-4">
            <div class="form-group">
                <label for="author" class="control-label">制单人</label>
                <input type="text" id="author" class="form-control" name="author" placeholder="制单人">
            </div>
        </div>
        <div class="col-md-4">
            <div class="form-group">
                <label class="control-label">供应商</label>
                <select class="form-control" name="supplier_id">
                    <option value="" >默认</option>
                    {volist name='supplier' id='vo'}
                    <option value="{$vo.id}">{$vo.name}</option>
                    {/volist}
                </select>
            </div>
        </div>

        <div class="col-md-4">
            <div class="form-group">
                <label class="control-label">仓库</label>
                <select class="form-control" name="storage_id">
                    <option value="" >默认</option>
                    {volist name='storage' id='vo'}
                    <option value="{$vo.id}">{$vo.name}</option>
                    {/volist}
                </select>
            </div>
        </div>
    </div>


    <table class="table table-striped table-bordered table-hover dataTable no-footer">
        <thead>
        <tr role="row">
            <th></th>
            <th>货物名称</th>
            <th>单价(元)</th>
            <th>数量</th>
            <th>单位</th>
            <th></th>
        </tr>
        </thead>
        <tbody>
        <tr role="row" class="odd order-list">
            <td style="width:56px;">
                <a href="javascript:void(0);" onclick="add_list(this)"> [ + ] </a>
            </td>
            <td style="width:230px;">
                <select name="category[]" class="form-control">
                    <option value="" >默认</option>
                    {volist name='category' id='vo'}
                    <option value="{$vo.id}" {lt name="$vo.level" value="2"} disabled="disabled" {/lt}>{:str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', $vo.level).$vo.name}</option>
                    {/volist}
                </select>
            </td>
            <td><input type="text" class="form-control" value="" name="price[]"></td>
            <td><input type="text" class="form-control" value="" name="num[]"></td>
            <td style="width:160px;">
                <select name="unit[]" class="form-control">
                    {volist name='unit' id='vo'}
                    <option value="{$vo.id}">{$vo.name}</option>
                    {/volist}
                </select>
            </td>
            <td style="width:56px;">
                <a class="delete" href="javascript:void(0)" onclick="del_list(this)"> [ - ] </a>
            </td>
        </tr>

        </tbody>
    </table>




    <div class="row">
        <div class="col-md-12">
            <div class="form-group no-margin">
                <label for="desc" class="control-label">备注</label>
                <textarea class="form-control autogrow" id="desc" name="desc" placeholder="备注" style="overflow: hidden; word-wrap: break-word; resize: horizontal; height: 50px;"></textarea>
            </div>
        </div>
    </div>


</form>


<script>

    function add_list(obj){
        // $(obj).parent().parent().hide();
        $(obj).parent().parent().clone().appendTo( $(obj).parent().parent().parent() );
    }

    function del_list(obj){
        $(obj).parent().parent().remove();
    }

</script>